package func

/**
 *
 * @author tzp
 * @since 2021/1/16
 */
object CurriedFunc {
  def sum(x: Int, y: Int): Int = x + y

  def sumC(x: Int)(y: Int): Int = x + y

  def first(x: Int) = (y: Int) => x + y

  def main(args: Array[String]): Unit = {
    val sumCurried = (sum _).curried
    println(sumCurried(1)(2))

    println(sumC(1)(2))
    val firstC = sumC(1) _
    println(firstC)
    println(firstC(2))

    println(first(1))
    println(first(1)(2))
  }
}
